<#setting number_format="#">
/*
 * Copyright ${.now?string("yyyy")} the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package ${app.packageName}.dto;

import ${app.packageName}.bean.${api.name?cap_first}UpdateBean;<#if apidocs>
import net.ymate.apidocs.annotation.*;</#if>
import net.ymate.platform.commons.util.DateTimeUtils;
import net.ymate.platform.core.beans.annotation.*;
import net.ymate.platform.validation.annotation.*;
import net.ymate.platform.validation.validate.*;
import net.ymate.platform.webmvc.annotation.*;
import org.apache.commons.lang3.builder.ToStringBuilder;

import java.io.Serializable;

/**
 * <#if api.description?? && (api.description?length > 0)>${api.description}<br></#if>
 *
 * ${api.name?cap_first}UpdateDTO generated By CrudMojo on ${.now?string("yyyy/MM/dd a HH:mm")}
 *
 * @author ${app.author!"YMP (https://www.ymate.net/)"}
 * @version ${app.version!"1.0.0"}
 */
public class ${api.name?cap_first}UpdateDTO implements Serializable {

    private static final long serialVersionUID = 1L;

<#list normalFields as p><#if p.config?? && p.config.createOrUpdate?? && p.config.createOrUpdate.enabled><#if (p.description??)>
    /**
     * ${p.description}
     */</#if><#if apidocs>
    @ApiParam</#if><#if p.config.createOrUpdate.required>
    @VRequired</#if><#if p.config.createOrUpdate.validation??><#if p.config.createOrUpdate.validation.length?? && p.config.createOrUpdate.validation.length.enabled>
    @VLength(min = ${p.config.createOrUpdate.validation.length.min}, max = ${p.config.createOrUpdate.validation.length.max}, eq = ${p.config.createOrUpdate.validation.length.eq}<#if (p.config.createOrUpdate.validation.length.msg?length > 0)>, msg = "${p.config.createOrUpdate.validation.length.msg}"</#if>)</#if><#if p.config.createOrUpdate.validation.dataRange?? && p.config.createOrUpdate.validation.dataRange.enabled && p.config.createOrUpdate.validation.dataRange.values?? && (p.config.createOrUpdate.validation.dataRange.values?size > 0)>
    @VDataRange(value = {<#list p.config.createOrUpdate.validation.dataRange.values as v>"${v}"<#if v_has_next>, </#if></#list>}, ignoreCase = ${p.config.createOrUpdate.validation.dataRange.ignoreCase?string}<#if (p.config.createOrUpdate.validation.dataRange.msg?length > 0)>, msg = "${p.config.createOrUpdate.validation.dataRange.msg}"</#if>)</#if><#if p.config.createOrUpdate.validation??><#if p.config.createOrUpdate.validation.regex?? && p.config.createOrUpdate.validation.regex.enabled && (p.config.createOrUpdate.validation.regex.regex?length > 0)>
    @VRegex(regex = "${p.config.createOrUpdate.validation.regex.regex}"<#if (p.config.createOrUpdate.validation.regex.msg?length > 0)>, msg = "${p.config.createOrUpdate.validation.regex.msg}"</#if>)</#if><#if p.config.createOrUpdate.validation.idCard?? && p.config.createOrUpdate.validation.idCard.enabled>
    @VIDCard<#if (p.config.createOrUpdate.validation.idCard.msg?length > 0)>(msg = "${p.config.createOrUpdate.validation.idCard.msg}")</#if></#if><#if p.config.createOrUpdate.validation.email?? && p.config.createOrUpdate.validation.email.enabled>
    @VEmail<#if (p.config.createOrUpdate.validation.email.msg?length > 0)>(msg = "${p.config.createOrUpdate.validation.email.msg}")</#if></#if><#if p.config.createOrUpdate.validation.mobile?? && p.config.createOrUpdate.validation.mobile.enabled>
    @VMobile(regex = "${p.config.createOrUpdate.validation.mobile.regex!""}"<#if (p.config.createOrUpdate.validation.mobile.msg?length > 0)>, msg = "${p.config.createOrUpdate.validation.mobile.msg}"</#if><#if (p.config.createOrUpdate.validation.mobile.msg?length > 0)>, msg = "${p.config.createOrUpdate.validation.mobile.msg}"</#if>)</#if><#if p.config.createOrUpdate.validation.numeric?? && p.config.createOrUpdate.validation.numeric.enabled>
    @VNumeric(min = ${p.config.createOrUpdate.validation.numeric.min}, max = ${p.config.createOrUpdate.validation.numeric.max}, eq = ${p.config.createOrUpdate.validation.numeric.eq}, decimals = ${p.config.createOrUpdate.validation.numeric.decimals}<#if (p.config.createOrUpdate.validation.numeric.msg?length > 0)>, msg = "${p.config.createOrUpdate.validation.numeric.msg}"</#if>)</#if></#if><#if p.description?? && (p.description?length > 0)>
    @VField(name = "${p.description}")</#if></#if>
    @RequestParam
    private ${p.type} ${p.name};</#if>

</#list><#list normalFields as p><#if p.config?? && p.config.createOrUpdate?? && p.config.createOrUpdate.enabled>
    public ${p.type} get${p.name?cap_first}() {
        return ${p.name};
    }

    public void set${p.name?cap_first}(${p.type} ${p.name}) {
        this.${p.name} = ${p.name};
    }

</#if></#list><#if (normalFields?size > 0)>
    public ${api.name?cap_first}UpdateBean toBean() {
        ${api.name?cap_first}UpdateBean.Builder builder = ${api.name?cap_first}UpdateBean.builder()<#list normalFields as p><#if p.config?? && p.config.createOrUpdate?? && p.config.createOrUpdate.enabled>
                .${p.name}(${p.name})</#if></#list>;
        return builder.build();
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this)<#list normalFields as p><#if p.config?? && p.config.createOrUpdate?? && p.config.createOrUpdate.enabled>
            .append("${p.name}", ${p.name})</#if></#list>
        .toString();
    }

    public Builder bind() {
        return new Builder(this);
    }

    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {

        private final ${api.name?cap_first}UpdateDTO targetDTO;

        public Builder() {
            targetDTO = new ${api.name?cap_first}UpdateDTO();
        }

        public Builder(${api.name?cap_first}UpdateDTO targetDTO) {
            this.targetDTO = targetDTO;
        }

        public ${api.name?cap_first}UpdateDTO build() {
            return targetDTO;
        }<#list normalFields as p><#if p.config?? && p.config.createOrUpdate?? && p.config.createOrUpdate.enabled>

        public ${p.type} ${p.name}() {
            return targetDTO.get${p.name?cap_first}();
        }

        public Builder ${p.name}(${p.type} ${p.name}) {
            targetDTO.set${p.name?cap_first}(${p.name});
            return this;
        }</#if></#list>
    }</#if>
}